<?php
namespace app\home\controller;

use \app\home\model\Chapter as Chapter;
use \app\home\model\StudentComment as Comment;
use \think\Validate as Validate;
class Learn extends Home {
    public function read(){
        $get = $this->req->get();
        $rule = [
            'id' => 'require'
        ];
        $validate = new Validate($rule);
        if($validate->check($get)){
            $model = new Chapter;
            $chapter = $model->where(['chat_id' => $get['id']] )->find();
            $this->assign('chapter',$chapter);

            $model = new Comment;
            $comment = $model->where(['chat_id'=>$get['id']])->select();
            $this->assign('comment',$comment);
            return $this->fetch();
        }else{
            // return $this->error('没有内容');
        }
    }
}
